#=====================================================================
CODEBOOK
Title: Strengthening the Party, Weakening the Women
Journal: The Journal of Politics
Authors: Andrea Junqueira and Patrick Cunha Silva
Contact information: andrea.junqueira.m@gmail.com|pcunhasilva@luc.edu
#=====================================================================

##############
#--Codebook--#
##############

#--d.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) #

- codeyear: Identifier of election-municipalities;
- CODIGO_MUNICIPIO: Identifier of municipalities;
- ANO_ELEICAO: Election year (municipal elections);
- NUMERO_PARTIDO: Party number;
- SIGLA_PARTIDO: Party name (abbreviated);
- diff_cand: Percentage points difference in votes between the first and second-place candidates in the mayoral election;
- CODIGO_SEXO: Mayoral candidade's sex (2 = Male; 4 = Female);
- eleito: Indicates if the mayoral candidate was elected;
- position: Indicates the candidate's place in the given municipal election (e.g., 1st most voted, 2nd most voted);
- total_party_mun_fem_wonBefore_DF: Total votes received by party candidates running for federal deputy (only candidates who have won elections in the past);
- total_mun_wonBefore_DF: Total votes given to candidates running for federal deputy in the municipality across all parties (only candidates who have won elections in the past are considered);
- perc_party_mun_candBefore_DF: Percentage of votes received by the party's candidates in the municipality (only candidates who have run in the past are considered);  
- perc_party_mun_fem_candBefore_DF: Percentage of votes received by the party's female candidates in the municipality (only female candidates who ran in the past are considered);
- perc_party_mun_wonBefore_DF: Percentage of votes received by the party's candidates in the municipality (only candidates who have won elections in the past are considered); 
- perc_party_mun_fem_wonBefore_DF: Percentage of votes received by the party's female candidates in the municipality (only female candidates who won elections in the past are considered); 
- n_party_candidates_candBefore_DF: Number of the party's federal deputy candidates who have participated in elections in the past;
- n_party_Femcandidates_candBefore_DF: Number of  the party's female federal deputy candidates who have participated in elections in the past;
- n_party_candidates_wonBefore_DF: Number of the party's federal deputy candidates who have won at least one election in the past;
- n_party_Femcandidates_wonBefore_DF: Number of the party's female federal deputy candidates who have won at least one election in the past;
- perc_party_mun_placebo1DF: Percentage of votes received by the party's federal deputy candidates in the municipality in the previous elections; 
- perc_party_mun_fem_placebo1DF: Percentage of votes received by the party's female federal deputy candidates in the municipality in the previous elections; 
- n_party_candidates_placebo1DF: Number of the party's federal deputy candidates in the previous elections;
- n_party_Femcandidates_placebo1DF: Number of the party's female federal deputy candidates in the previous elections;
- perc_party_mun_placebo1DE: Percentage of votes received by the party's state deputy candidates in the municipality in the previous elections;   
- perc_party_mun_fem_placebo1DE: Percentage of votes received by the party's female state deputy candidates in the municipality in the previous elections;
- n_party_candidates_placebo1DE: Number of the party's state deputy candidates in the previous elections;
- n_party_Femcandidates_placebo1DE: Number of the party's female state deputy candidates in the previous elections;
- run_var: Running variable (percentage points difference between the winner and the first loser in the mayoral election);
- mayorFem: Indicates if the mayor is a woman;
- nonZeroDF: Informs about the gender distribution of the party's federal deputy candidates (0 = the party had no candidates competing, 1 = the party had only one gender competing; 2 = the party had women and men competing); 
- avg_male_DF: Percentage of votes received by each male federal deputy party candidate in the municipality, on average;
- avg_fem_DF: Percentage of votes received by each female federal deputy party candidate in the municipality, on average;
- avg_DF: Percentage of votes received by each federal deputy party candidate in the municipality, on average;

-----------------------

#--d_balance.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) #
- codeyear: Identifier of election-municipalities;
- CODIGO_MUNICIPIO: Identifier of municipalities;
- ANO_ELEICAO: Election year (municipal elections);
- NUMERO_PARTIDO: Party number;
- total_votes_party_vereador: Number of votes received by the party's city council candidates;
- total_votes_party_fem_vereador: Number of votes received by the party's female city council candidates;
- n_candidates_vereador: Number of the party city council candidates; 
- n_candidates_fem_vereador: Number of the party female city council candidates; 
- total_votes_party_DF: Number of votes received by all party's federal deputy candidates in the municipality;
- total_votes_party_fem_DF: Number of votes received by all female party's federal deputy candidates in the municipality;
- total_votes_party_laranja_DF: Number of votes received by all party's "laranja" candidates in the municipality.
- total_votes_party_fem_laranja_DF: Number of votes received by all party's female "laranja" candidates in the municipality.
- n_candidates_DF: Number of party candidates running for federal elections in the state.
- n_candidates_fem_DF: Number of female party candidates running for federal deputy in the state.
- n_candidates_laranja_DF: Number of "laranja" party candidates running for federal deputy in the state.         
- n_candidates_fem_laranja_DF: Number of "laranja" female party candidates running for federal deputy in the state.      
- total_votes_district_vereador: Total number of votes given to all city council candidates in the municipality.
- total_votes_district_DF: Total number of votes given to all federal deputy candidates in the municipality.

-----------------------

#--balance_ind.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) #

- ANO_ELEICAO: Election year (municipal elections);
- SG_UE: Identifier of municipalities;
- NR_PARTIDO: Party number;
- business_occ: Indicates if the candidate declared a business-related occupation at the moment of the election;
- health_occ: Indicates if the candidate declared a healthcare-related occupation at the moment of the election;
- education_occ: Indicates if the candidate declared an education-related occupation at the moment of the election;
- merchant_occ: Indicates if the candidate declared a sales-related occupation at the moment of the election;
- farmer_occ: Indicates if the candidate declared a farming-related occupation at the moment of the election;
- pubservant_occ: Indicates if the candidate declared an occupation in the public sector at the moment of the election;
- laywer_pcc: Indicates if the candidate declared to be a lawyer the moment of the election;
- incumbent: Indicates the incumbent candidate;
- held_office: Indicates if the candidate held office in the past;
- ran_office: Indicates if the candidate has run for office in the past;
- age: Candidate's age.
- married: Indicates if the candidate is married;
- highschool: Indicates if the candidate completed high-school;
- somecollege: Indicates if the candidate has at least some college education;

-----------------------

#--bal_checks_census.RData--#
# Original source: Instituto Brasileiro de Geografia e Estatistica (IBGE) #

- municipality: Municipality name;
- yr_census: Census year;
- ID_ibge: Identifier of municipalities;
- perc_literate: Percentage of literate residents in the municipality;
- total_pop: Total number of residents in the municipality;
- perc_female: Percentage of female residents in the municipality;
- perc_urban: Percentage of residents who reside in urban areas in the municipality;
- perc_white: Percentage of residents who identify themselves as "white" in the municipality;
- perc_rede_geral: Percentage of residents with access to basic sanitation in the municipality;

-----------------------

#--DespesaMunicipal.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) #

- NR_PART: Party number;
- SG_UE: Identifier of municipalities;
- DESPESA: Party's mayoral campaign expenditures;
- ANO_ELEICAO: Election year (municipal elections)

-----------------------

#--loyalty_cases.RData--#
# Original source: Tribunais Regionais Eleitorais (TREs) #

- year: Year in which the judicial case was created;
- centralized: Indicates if the party is centralized;
- n_cases_year_by_type: Total number of loyalty cases involving each category of parties (centralized and decentralized) in the given year;
- n_eleitos_year_by_type: Total number elected candidates in the 2008 municipal elections by each category of parties (centralized and decentralized); 

-----------------------

#--median_df.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) #

- codeyear: Identifier of election-municipalities;
- ANO_ELEICAO: Election year (municipal elections);
- CODIGO_MUNICIPIO: Identifier of municipalities;
- NUMERO_PARTIDO: Party number;
- median_allcand: Median percentage of votes received by federal deputy party candidates in the municipality;
- median_fem: Median percentage of votes received by federal deputy female party candidates in the municipality;
- median_male: Median percentage of votes received by federal deputy male party candidates in the municipality;

-----------------------

#--tse_ibge.RData--#
# Original source: Tribunal Superior Eleitoral (TSE) and Instituto Brasileiro de Geografia e Estatistica (IBGE) #
- codigo_tse: Municipal identifier used by the TSE;
- codigo_ibge: Municipal identifier used by the IBGE;

